#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Copyright © 启明星辰 版权所有
# @Time    : 2023/11/1 16:15
# @Author  : 胡浩浩
# @File    : start_app.py
# @IDE     : PyCharm
# @description :

import uvicorn
from pywebio import config
from pywebio.platform.fastapi import asgi_app
from apps.api import app
from apps.src.manage.api_doc_manage import html_show_api
from apps.src.manage.case_api_count import html_show_api_count
from apps.src.manage.count_data_manage import show_html_data_market
from apps.src.manage.group_manage import html_show_group
from apps.src.manage.test_sheet_manage import html_show_test_sheet
from apps.src.menus import show_menus
from config import APIPORT

css = """
.container {
    margin-top: 0;
    max-width: 100%;
    margin-left: 0px;
    margin-top: 0px;
    background-color: #FFFCFB;
    background-image: null;
    background-size: 100% 100%;
}
"""
config(css_style=css)
# 注册菜单路由
app.mount("/menus", asgi_app(show_menus,cdn=False))
app.mount("/show_api", asgi_app(html_show_api,cdn=False))
app.mount("/test_sheet", asgi_app(html_show_test_sheet,cdn=False))
app.mount("/group", asgi_app(html_show_group,cdn=False))
app.mount("/data_market", asgi_app(show_html_data_market,cdn=False))
app.mount("/api_count", asgi_app(html_show_api_count,cdn=False))

if __name__ == '__main__':
    # scheduler_run()
    uvicorn.run(app,host="0.0.0.0", port=APIPORT)
    # ps -ef | grep start_app.py
    # nohup python3 start_app.py > output.log 2>&1 &